package belf.migrate.api.type;

public enum MigrationObjectType {
    TABLE_STRUCTURE("table_structure", "表结构"),
    INDEX("index", "索引"),
    TRIGGER("trigger", "触发器"),
    VIEW("view", "视图"),
    SYNONYM("synonym", "同义词"),
    SEQUENCE("sequence", "序列"),
    PROCEDURE("procedure", "存储过程"),
    FUNCTION("function", "函数"),
    TYPE("type", "类型");


    private String name;

    private String desc;

    MigrationObjectType(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static MigrationObjectType getMigrationObjectType(String name) {
        for (MigrationObjectType migrationObjectType : MigrationObjectType.values()) {
            if (migrationObjectType.getName().equals(name)) {
                return migrationObjectType;
            }
        }
        return null;
    }
}
